<template>
  <scroll class="menu-bar">
    <ul class="menu">
      <li
        class="menu-item"
        :class="{'menu-active':currentIndex===index}"
        v-for="(item,index) of menuTitle"
        :key="item.title"
        @click="menuClick(index)"
      >{{ item.title }}</li>
    </ul>
  </scroll>
</template>

<script>
import scroll from "components/content/scroll/scroll";
export default {
  name: "menuBar",
  data() {
    return {
      currentIndex: 0
    };
  },
  props: {
    menuTitle: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  components: {
    scroll
  },
  methods: {
    menuClick(index) {
      this.currentIndex = index;
      this.$emit("menuClick", index);
    }
  }
};
</script>

<style lang="less" scoped>
.menu-bar {
  width: 100px;
  height: 100%;
  background-color: #f6f6f6;
  .menu {
    width: 100px;
    text-align: center;
    font-size: 14px;
    .menu-item {
      height: 45px;
      line-height: 45px;
      width: 100px;
      &.menu-active {
        background-color: #fff;
        color: var(--color-high-text);
        border-left: 2px solid #ff5777;
        font-weight: 600;
      }
    }
  }
}
</style>